westwood: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		
							parent
							
								
									36fc3e9b05
								
							
						
					
					
						commit
						0116c9162e
					
				| @ -118,9 +118,7 @@ static int wsaud_read_header(AVFormatContext *s) | |||||||
|     } |     } | ||||||
|     avpriv_set_pts_info(st, 64, 1, sample_rate); |     avpriv_set_pts_info(st, 64, 1, sample_rate); | ||||||
|     st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO; |     st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO; | ||||||
|     st->codecpar->channels    = channels; |     av_channel_layout_default(&st->codecpar->ch_layout, channels); | ||||||
|     st->codecpar->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO : |  | ||||||
|                                                    AV_CH_LAYOUT_STEREO; |  | ||||||
|     st->codecpar->sample_rate = sample_rate; |     st->codecpar->sample_rate = sample_rate; | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
| @ -164,14 +162,14 @@ static int wsaud_read_packet(AVFormatContext *s, | |||||||
|         if (ret != chunk_size) |         if (ret != chunk_size) | ||||||
|             return AVERROR(EIO); |             return AVERROR(EIO); | ||||||
| 
 | 
 | ||||||
|         if (st->codecpar->channels <= 0) { |         if (st->codecpar->ch_layout.nb_channels <= 0) { | ||||||
|             av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", |             av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", | ||||||
|                    st->codecpar->channels); |                    st->codecpar->ch_layout.nb_channels); | ||||||
|             return AVERROR_INVALIDDATA; |             return AVERROR_INVALIDDATA; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */ |         /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */ | ||||||
|         pkt->duration = (chunk_size * 2) / st->codecpar->channels; |         pkt->duration = (chunk_size * 2) / st->codecpar->ch_layout.nb_channels; | ||||||
|     } |     } | ||||||
|     pkt->stream_index = st->index; |     pkt->stream_index = st->index; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -77,7 +77,7 @@ static int wsaud_write_header(AVFormatContext *ctx) | |||||||
|     a->size = 0; |     a->size = 0; | ||||||
| 
 | 
 | ||||||
|     /* Flag if we have stereo data. */ |     /* Flag if we have stereo data. */ | ||||||
|     if (st->codecpar->channels == 2) |     if (st->codecpar->ch_layout.nb_channels == 2) | ||||||
|         flags |= 1; |         flags |= 1; | ||||||
| 
 | 
 | ||||||
|     /* This flags that the file contains 16 bit samples rather than 8 bit
 |     /* This flags that the file contains 16 bit samples rather than 8 bit
 | ||||||
|  | |||||||
| @ -226,7 +226,7 @@ static int wsvqa_read_packet(AVFormatContext *s, | |||||||
|                         wsvqa->bps = 8; |                         wsvqa->bps = 8; | ||||||
|                     st->codecpar->sample_rate = wsvqa->sample_rate; |                     st->codecpar->sample_rate = wsvqa->sample_rate; | ||||||
|                     st->codecpar->bits_per_coded_sample = wsvqa->bps; |                     st->codecpar->bits_per_coded_sample = wsvqa->bps; | ||||||
|                     st->codecpar->channels = wsvqa->channels; |                     av_channel_layout_default(&st->codecpar->ch_layout, wsvqa->channels); | ||||||
|                     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |                     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; | ||||||
| 
 | 
 | ||||||
|                     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); |                     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user