previously only codec_ids could be forced, which did not allow forcing a specific implementation like libopenjpeg vs jpeg2000.
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2012-10-22 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2013-10-02 - xxxxxxx - lavf 55.19.100 - avformat.h | |
| 19 | + Add audio/video/subtitle AVCodec fields to AVFormatContext to force specific | |
| 20 | + decoders | |
| 21 | + | |
| 18 | 22 | 2013-08-xx - xxxxxxx - lavfi 3.11.0 - avfilter.h |
| 19 | 23 | Add AVFilterGraph.execute and AVFilterGraph.opaque for custom slice threading |
| 20 | 24 | implementations. |
| @@ -1315,9 +1315,39 @@ typedef struct AVFormatContext { · 1314 unmodified lines | ||
| 1315 | 1315 | * Demuxers can use the flag to detect such changes. |
| 1316 | 1316 | */ |
| 1317 | 1317 | int io_repositioned; |
| 1318 | + | |
| 1319 | + /** | |
| 1320 | + * Forced video codec. | |
| 1321 | + * This allows forcing a specific decoder, even when there are multiple with | |
| 1322 | + * the same codec_id. | |
| 1323 | + * Demuxing: Set by user via av_format_set_video_codec (NO direct access). | |
| 1324 | + */ | |
| 1325 | + AVCodec *video_codec; | |
| 1326 | + | |
| 1327 | + /** | |
| 1328 | + * Forced audio codec. | |
| 1329 | + * This allows forcing a specific decoder, even when there are multiple with | |
| 1330 | + * the same codec_id. | |
| 1331 | + * Demuxing: Set by user via av_format_set_audio_codec (NO direct access). | |
| 1332 | + */ | |
| 1333 | + AVCodec *audio_codec; | |
| 1334 | + | |
| 1335 | + /** | |
| 1336 | + * Forced subtitle codec. | |
| 1337 | + * This allows forcing a specific decoder, even when there are multiple with | |
| 1338 | + * the same codec_id. | |
| 1339 | + * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct access). | |
| 1340 | + */ | |
| 1341 | + AVCodec *subtitle_codec; | |
| 1318 | 1342 | } AVFormatContext; |
| 1319 | 1343 | |
| 1320 | 1344 | int av_format_get_probe_score(const AVFormatContext *s); |
| 1345 | +AVCodec * av_format_get_video_codec(const AVFormatContext *s); | |
| 1346 | +void av_format_set_video_codec(AVFormatContext *s, AVCodec *c); | |
| 1347 | +AVCodec * av_format_get_audio_codec(const AVFormatContext *s); | |
| 1348 | +void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c); | |
| 1349 | +AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s); | |
| 1350 | +void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c); | |
| 1321 | 1351 | |
| 1322 | 1352 | /** |
| 1323 | 1353 | * Returns the method used to set ctx->duration. |
| @@ -98,12 +98,27 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) · 97 unmodified lines | ||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate) |
| 101 | +MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, video_codec) | |
| 102 | +MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, audio_codec) | |
| 103 | +MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec) | |
| 101 | 104 | |
| 102 | 105 | static AVCodec *find_decoder(AVFormatContext *s, AVStream *st, enum AVCodecID codec_id) |
| 103 | 106 | { |
| 104 | 107 | if (st->codec->codec) |
| 105 | 108 | return st->codec->codec; |
| 106 | 109 | |
| 110 | + switch(st->codec->codec_type){ | |
| 111 | + case AVMEDIA_TYPE_VIDEO: | |
| 112 | + if(s->video_codec) return s->video_codec; | |
| 113 | + break; | |
| 114 | + case AVMEDIA_TYPE_AUDIO: | |
| 115 | + if(s->audio_codec) return s->audio_codec; | |
| 116 | + break; | |
| 117 | + case AVMEDIA_TYPE_SUBTITLE: | |
| 118 | + if(s->subtitle_codec) return s->subtitle_codec; | |
| 119 | + break; | |
| 120 | + } | |
| 121 | + | |
| 107 | 122 | return avcodec_find_decoder(codec_id); |
| 108 | 123 | } |
| 109 | 124 | |
| @@ -30,8 +30,8 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "libavutil/avutil.h" |
| 31 | 31 | |
| 32 | 32 | #define LIBAVFORMAT_VERSION_MAJOR 55 |
| 33 | −#define LIBAVFORMAT_VERSION_MINOR 18 | |
| 34 | −#define LIBAVFORMAT_VERSION_MICRO 104 | |
| 33 | +#define LIBAVFORMAT_VERSION_MINOR 19 | |
| 34 | +#define LIBAVFORMAT_VERSION_MICRO 100 | |
| 35 | 35 | |
| 36 | 36 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| 37 | 37 | LIBAVFORMAT_VERSION_MINOR, \ |