History

avcodec, avutil, avformat: remove AVOption requirement for some fields

Allow all struct fields to be accessed directly, as long as they're public. Before this change, many fields were "public", but could be accessed via AVOption only. This meant they were effectively not public, but were present for documentation purposes, which was incredibly confusing at best.

wm4 committed 9 years ago

Commit 554bc4e1 parent 37330397 files · +42 −76Browse files

Unified · Split

7 files
  1. doc/APIchanges +5 −0
  2. libavcodec/avcodec.h +5 −20
  3. libavcodec/version.h +1 −1
  4. libavformat/avformat.h +26 −24
  5. libavformat/version.h +1 −1
  6. libavutil/frame.h +3 −29
  7. libavutil/version.h +1 −1
doc/APIchanges+5−0
@@ -15,6 +15,11 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2017-03-02 - xxxxxxx - lavu 55.47.101, lavc 57.81.102, lavf 57.66.103
19+ Remove requirement to use AVOption or accessors to access certain fields
20+ in AVFrame, AVCodecContext, and AVFormatContext that were previously
21+ documented as "no direct access" allowed.
22+
1823 2017-02-13 - xxxxxxx - lavc 57.80.100 - avcodec.h
1924 Add AVCodecContext.hw_device_ctx.
2025
libavcodec/avcodec.h+5−20
@@ -1680,7 +1680,7 @@ enum AVFieldOrder { · 1679 unmodified lines
16801680 * New fields can be added to the end with minor version bumps.
16811681 * Removal, reordering and changes to existing fields require a major
16821682 * version bump.
1683− * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user
1683+ * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
16841684 * applications.
16851685 * The name string for AVOptions options matches the associated command line
16861686 * parameter name and can be found in libavcodec/options_table.h
@@ -2951,8 +2951,8 @@ typedef struct AVCodecContext { · 1264 unmodified lines
29512951 #define FF_DEBUG_MMCO 0x00000800
29522952 #define FF_DEBUG_BUGS 0x00001000
29532953 #if FF_API_DEBUG_MV
2954−#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec
2955−#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec
2954+#define FF_DEBUG_VIS_QP 0x00002000
2955+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
29562956 #endif
29572957 #define FF_DEBUG_BUFFERS 0x00008000
29582958 #define FF_DEBUG_THREADS 0x00010000
@@ -2962,7 +2962,6 @@ typedef struct AVCodecContext { · 3 unmodified lines
29622962 #if FF_API_DEBUG_MV
29632963 /**
29642964 * debug
2965− * Code outside libavcodec should access this field using AVOptions
29662965 * - encoding: Set by user.
29672966 * - decoding: Set by user.
29682967 */
@@ -3097,8 +3096,6 @@ typedef struct AVCodecContext { · 128 unmodified lines
30973096 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
30983097 * - encoding: unused
30993098 * - decoding: Set by user.
3100− * Code outside libavcodec should access this field using:
3101− * av_codec_{get,set}_lowres(avctx)
31023099 */
31033100 int lowres;
31043101 #endif
@@ -3399,8 +3396,6 @@ typedef struct AVCodecContext { · 294 unmodified lines
33993396
34003397 /**
34013398 * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
3402− * Code outside libavcodec should access this field using:
3403− * av_codec_{get,set}_pkt_timebase(avctx)
34043399 * - encoding unused.
34053400 * - decoding set by user.
34063401 */
@@ -3408,8 +3403,6 @@ typedef struct AVCodecContext { · 1 unmodified line
34083403
34093404 /**
34103405 * AVCodecDescriptor
3411− * Code outside libavcodec should access this field using:
3412− * av_codec_{get,set}_codec_descriptor(avctx)
34133406 * - encoding: unused.
34143407 * - decoding: set by libavcodec.
34153408 */
@@ -3420,8 +3413,6 @@ typedef struct AVCodecContext { · 4 unmodified lines
34203413 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
34213414 * - encoding: unused
34223415 * - decoding: Set by user.
3423− * Code outside libavcodec should access this field using:
3424− * av_codec_{get,set}_lowres(avctx)
34253416 */
34263417 int lowres;
34273418 #endif
@@ -3462,7 +3453,6 @@ typedef struct AVCodecContext { · 34 unmodified lines
34623453 * However for formats that do not use pre-multiplied alpha
34633454 * there might be serious artefacts (though e.g. libswscale currently
34643455 * assumes pre-multiplied alpha anyway).
3465− * Code outside libavcodec should access this field using AVOptions
34663456 *
34673457 * - decoding: set by user
34683458 * - encoding: unused
@@ -3479,7 +3469,6 @@ typedef struct AVCodecContext { · 10 unmodified lines
34793469 #if !FF_API_DEBUG_MV
34803470 /**
34813471 * debug motion vectors
3482− * Code outside libavcodec should access this field using AVOptions
34833472 * - encoding: Set by user.
34843473 * - decoding: Set by user.
34853474 */
@@ -3491,7 +3480,6 @@ typedef struct AVCodecContext { · 5 unmodified lines
34913480
34923481 /**
34933482 * custom intra quantization matrix
3494− * Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix()
34953483 * - encoding: Set by user, can be NULL.
34963484 * - decoding: unused.
34973485 */
@@ -3500,8 +3488,6 @@ typedef struct AVCodecContext { · 2 unmodified lines
35003488 /**
35013489 * dump format separator.
35023490 * can be ", " or "\n " or anything else
3503− * Code outside libavcodec should access this field using AVOptions
3504− * (NO direct access).
35053491 * - encoding: Set by user.
35063492 * - decoding: Set by user.
35073493 */
@@ -3511,13 +3497,12 @@ typedef struct AVCodecContext { · 3 unmodified lines
35113497 * ',' separated list of allowed decoders.
35123498 * If NULL then all are allowed
35133499 * - encoding: unused
3514− * - decoding: set by user through AVOPtions (NO direct access)
3500+ * - decoding: set by user
35153501 */
35163502 char *codec_whitelist;
35173503
35183504 /*
35193505 * Properties of the stream that gets decoded
3520− * To be accessed through av_codec_get_properties() (NO direct access)
35213506 * - encoding: unused
35223507 * - decoding: set by libavcodec
35233508 */
@@ -3668,7 +3653,7 @@ typedef struct AVCodec { · 144 unmodified lines
36683653 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
36693654 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
36703655 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
3671− uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres()
3656+ uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
36723657 const AVClass *priv_class; ///< AVClass for the private context
36733658 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
36743659
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 57
3131 #define LIBAVCODEC_VERSION_MINOR 81
32−#define LIBAVCODEC_VERSION_MICRO 101
32+#define LIBAVCODEC_VERSION_MICRO 102
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
3535 LIBAVCODEC_VERSION_MINOR, \
libavformat/avformat.h+26−24
@@ -1649,7 +1649,7 @@ typedef struct AVFormatContext { · 1648 unmodified lines
16491649 /**
16501650 * Audio preload in microseconds.
16511651 * Note, not all formats support this and unpredictable things may happen if it is used when not supported.
1652− * - encoding: Set by user via AVOptions (NO direct access)
1652+ * - encoding: Set by user
16531653 * - decoding: unused
16541654 */
16551655 int audio_preload;
@@ -1657,7 +1657,7 @@ typedef struct AVFormatContext { · 1 unmodified line
16571657 /**
16581658 * Max chunk time in microseconds.
16591659 * Note, not all formats support this and unpredictable things may happen if it is used when not supported.
1660− * - encoding: Set by user via AVOptions (NO direct access)
1660+ * - encoding: Set by user
16611661 * - decoding: unused
16621662 */
16631663 int max_chunk_duration;
@@ -1665,7 +1665,7 @@ typedef struct AVFormatContext { · 1 unmodified line
16651665 /**
16661666 * Max chunk size in bytes
16671667 * Note, not all formats support this and unpredictable things may happen if it is used when not supported.
1668− * - encoding: Set by user via AVOptions (NO direct access)
1668+ * - encoding: Set by user
16691669 * - decoding: unused
16701670 */
16711671 int max_chunk_size;
@@ -1674,14 +1674,14 @@ typedef struct AVFormatContext { · 2 unmodified lines
16741674 * forces the use of wallclock timestamps as pts/dts of packets
16751675 * This has undefined results in the presence of B frames.
16761676 * - encoding: unused
1677− * - decoding: Set by user via AVOptions (NO direct access)
1677+ * - decoding: Set by user
16781678 */
16791679 int use_wallclock_as_timestamps;
16801680
16811681 /**
16821682 * avio flags, used to force AVIO_FLAG_DIRECT.
16831683 * - encoding: unused
1684− * - decoding: Set by user via AVOptions (NO direct access)
1684+ * - decoding: Set by user
16851685 */
16861686 int avio_flags;
16871687
@@ -1689,34 +1689,34 @@ typedef struct AVFormatContext { · 1 unmodified line
16891689 * The duration field can be estimated through various ways, and this field can be used
16901690 * to know how the duration was estimated.
16911691 * - encoding: unused
1692− * - decoding: Read by user via AVOptions (NO direct access)
1692+ * - decoding: Read by user
16931693 */
16941694 enum AVDurationEstimationMethod duration_estimation_method;
16951695
16961696 /**
16971697 * Skip initial bytes when opening stream
16981698 * - encoding: unused
1699− * - decoding: Set by user via AVOptions (NO direct access)
1699+ * - decoding: Set by user
17001700 */
17011701 int64_t skip_initial_bytes;
17021702
17031703 /**
17041704 * Correct single timestamp overflows
17051705 * - encoding: unused
1706− * - decoding: Set by user via AVOptions (NO direct access)
1706+ * - decoding: Set by user
17071707 */
17081708 unsigned int correct_ts_overflow;
17091709
17101710 /**
17111711 * Force seeking to any (also non key) frames.
17121712 * - encoding: unused
1713− * - decoding: Set by user via AVOptions (NO direct access)
1713+ * - decoding: Set by user
17141714 */
17151715 int seek2any;
17161716
17171717 /**
17181718 * Flush the I/O context after each packet.
1719− * - encoding: Set by user via AVOptions (NO direct access)
1719+ * - encoding: Set by user
17201720 * - decoding: unused
17211721 */
17221722 int flush_packets;
@@ -1726,14 +1726,14 @@ typedef struct AVFormatContext { · 3 unmodified lines
17261726 * The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes
17271727 * the format.
17281728 * - encoding: unused
1729− * - decoding: set by avformat, read by user via av_format_get_probe_score() (NO direct access)
1729+ * - decoding: set by avformat, read by user
17301730 */
17311731 int probe_score;
17321732
17331733 /**
17341734 * number of bytes to read maximally to identify format.
17351735 * - encoding: unused
1736− * - decoding: set by user through AVOPtions (NO direct access)
1736+ * - decoding: set by user
17371737 */
17381738 int format_probesize;
17391739
@@ -1741,7 +1741,7 @@ typedef struct AVFormatContext { · 1 unmodified line
17411741 * ',' separated list of allowed decoders.
17421742 * If NULL then all are allowed
17431743 * - encoding: unused
1744− * - decoding: set by user through AVOptions (NO direct access)
1744+ * - decoding: set by user
17451745 */
17461746 char *codec_whitelist;
17471747
@@ -1749,7 +1749,7 @@ typedef struct AVFormatContext { · 1 unmodified line
17491749 * ',' separated list of allowed demuxers.
17501750 * If NULL then all are allowed
17511751 * - encoding: unused
1752− * - decoding: set by user through AVOptions (NO direct access)
1752+ * - decoding: set by user
17531753 */
17541754 char *format_whitelist;
17551755
@@ -1771,7 +1771,7 @@ typedef struct AVFormatContext { · 15 unmodified lines
17711771 * Forced video codec.
17721772 * This allows forcing a specific decoder, even when there are multiple with
17731773 * the same codec_id.
1774− * Demuxing: Set by user via av_format_set_video_codec (NO direct access).
1774+ * Demuxing: Set by user
17751775 */
17761776 AVCodec *video_codec;
17771777
@@ -1779,7 +1779,7 @@ typedef struct AVFormatContext { · 1 unmodified line
17791779 * Forced audio codec.
17801780 * This allows forcing a specific decoder, even when there are multiple with
17811781 * the same codec_id.
1782− * Demuxing: Set by user via av_format_set_audio_codec (NO direct access).
1782+ * Demuxing: Set by user
17831783 */
17841784 AVCodec *audio_codec;
17851785
@@ -1787,7 +1787,7 @@ typedef struct AVFormatContext { · 1 unmodified line
17871787 * Forced subtitle codec.
17881788 * This allows forcing a specific decoder, even when there are multiple with
17891789 * the same codec_id.
1790− * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct access).
1790+ * Demuxing: Set by user
17911791 */
17921792 AVCodec *subtitle_codec;
17931793
@@ -1795,7 +1795,7 @@ typedef struct AVFormatContext { · 1 unmodified line
17951795 * Forced data codec.
17961796 * This allows forcing a specific decoder, even when there are multiple with
17971797 * the same codec_id.
1798− * Demuxing: Set by user via av_format_set_data_codec (NO direct access).
1798+ * Demuxing: Set by user
17991799 */
18001800 AVCodec *data_codec;
18011801
@@ -1819,15 +1819,13 @@ typedef struct AVFormatContext { · 17 unmodified lines
18191819
18201820 /**
18211821 * Output timestamp offset, in microseconds.
1822− * Muxing: set by user via AVOptions (NO direct access)
1822+ * Muxing: set by user
18231823 */
18241824 int64_t output_ts_offset;
18251825
18261826 /**
18271827 * dump format separator.
18281828 * can be ", " or "\n " or anything else
1829− * Code outside libavformat should access this field using AVOptions
1830− * (NO direct access).
18311829 * - muxing: Set by user.
18321830 * - demuxing: Set by user.
18331831 */
@@ -1864,7 +1862,7 @@ typedef struct AVFormatContext { · 30 unmodified lines
18641862 /**
18651863 * ',' separated list of allowed protocols.
18661864 * - encoding: unused
1867− * - decoding: set by user through AVOptions (NO direct access)
1865+ * - decoding: set by user
18681866 */
18691867 char *protocol_whitelist;
18701868
@@ -1899,18 +1897,22 @@ typedef struct AVFormatContext { · 28 unmodified lines
18991897 /**
19001898 * ',' separated list of disallowed protocols.
19011899 * - encoding: unused
1902− * - decoding: set by user through AVOptions (NO direct access)
1900+ * - decoding: set by user
19031901 */
19041902 char *protocol_blacklist;
19051903
19061904 /**
19071905 * The maximum number of streams.
19081906 * - encoding: unused
1909− * - decoding: set by user through AVOptions (NO direct access)
1907+ * - decoding: set by user
19101908 */
19111909 int max_streams;
19121910 } AVFormatContext;
19131911
1912+/**
1913+ * Accessors for some AVFormatContext fields. These used to be provided for ABI
1914+ * compatibility, and do not need to be used anymore.
1915+ */
19141916 int av_format_get_probe_score(const AVFormatContext *s);
19151917 AVCodec * av_format_get_video_codec(const AVFormatContext *s);
19161918 void av_format_set_video_codec(AVFormatContext *s, AVCodec *c);
libavformat/version.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333 // Also please add any ticket numbers that you believe might be affected here
3434 #define LIBAVFORMAT_VERSION_MAJOR 57
3535 #define LIBAVFORMAT_VERSION_MINOR 66
36−#define LIBAVFORMAT_VERSION_MICRO 102
36+#define LIBAVFORMAT_VERSION_MICRO 103
3737
3838 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
3939 LIBAVFORMAT_VERSION_MINOR, \
libavutil/frame.h+3−29
@@ -179,9 +179,6 @@ typedef struct AVFrameSideData { · 178 unmodified lines
179179 *
180180 * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
181181 * to the end with a minor bump.
182− * Similarly fields that are marked as to be only accessed by
183− * av_opt_ptr() can be reordered. This allows 2 forks to add fields
184− * without breaking compatibility with each other.
185182 *
186183 * Fields can be accessed through AVOptions, the name string used, matches the
187184 * C structure field name for fields accessible through AVOptions. The AVClass
@@ -420,8 +417,6 @@ typedef struct AVFrame { · 232 unmodified lines
420417
421418 /**
422419 * MPEG vs JPEG YUV range.
423− * It must be accessed using av_frame_get_color_range() and
424− * av_frame_set_color_range().
425420 * - encoding: Set by user
426421 * - decoding: Set by libavcodec
427422 */
@@ -433,8 +428,6 @@ typedef struct AVFrame { · 5 unmodified lines
433428
434429 /**
435430 * YUV colorspace type.
436− * It must be accessed using av_frame_get_colorspace() and
437− * av_frame_set_colorspace().
438431 * - encoding: Set by user
439432 * - decoding: Set by libavcodec
440433 */
@@ -444,8 +437,6 @@ typedef struct AVFrame { · 3 unmodified lines
444437
445438 /**
446439 * frame timestamp estimated using various heuristics, in stream time base
447− * Code outside libavutil should access this field using:
448− * av_frame_get_best_effort_timestamp(frame)
449440 * - encoding: unused
450441 * - decoding: set by libavcodec, read by user.
451442 */
@@ -453,8 +444,6 @@ typedef struct AVFrame { · 1 unmodified line
453444
454445 /**
455446 * reordered pos from the last AVPacket that has been input into the decoder
456− * Code outside libavutil should access this field using:
457− * av_frame_get_pkt_pos(frame)
458447 * - encoding: unused
459448 * - decoding: Read by user.
460449 */
@@ -463,8 +452,6 @@ typedef struct AVFrame { · 2 unmodified lines
463452 /**
464453 * duration of the corresponding packet, expressed in
465454 * AVStream->time_base units, 0 if unknown.
466− * Code outside libavutil should access this field using:
467− * av_frame_get_pkt_duration(frame)
468455 * - encoding: unused
469456 * - decoding: Read by user.
470457 */
@@ -472,8 +459,6 @@ typedef struct AVFrame { · 1 unmodified line
472459
473460 /**
474461 * metadata.
475− * Code outside libavutil should access this field using:
476− * av_frame_get_metadata(frame)
477462 * - encoding: Set by user.
478463 * - decoding: Set by libavcodec.
479464 */
@@ -483,8 +468,6 @@ typedef struct AVFrame { · 3 unmodified lines
483468 * decode error flags of the frame, set to a combination of
484469 * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
485470 * were errors during the decoding.
486− * Code outside libavutil should access this field using:
487− * av_frame_get_decode_error_flags(frame)
488471 * - encoding: unused
489472 * - decoding: set by libavcodec, read by user.
490473 */
@@ -494,8 +477,6 @@ typedef struct AVFrame { · 3 unmodified lines
494477
495478 /**
496479 * number of audio channels, only used for audio.
497− * Code outside libavutil should access this field using:
498− * av_frame_get_channels(frame)
499480 * - encoding: unused
500481 * - decoding: Read by user.
501482 */
@@ -503,8 +484,7 @@ typedef struct AVFrame { · 1 unmodified line
503484
504485 /**
505486 * size of the corresponding packet containing the compressed
506− * frame. It must be accessed using av_frame_get_pkt_size() and
507− * av_frame_set_pkt_size().
487+ * frame.
508488 * It is set to a negative value if unknown.
509489 * - encoding: unused
510490 * - decoding: set by libavcodec, read by user.
@@ -514,13 +494,11 @@ typedef struct AVFrame { · 3 unmodified lines
514494 #if FF_API_FRAME_QP
515495 /**
516496 * QP table
517− * Not to be accessed directly from outside libavutil
518497 */
519498 attribute_deprecated
520499 int8_t *qscale_table;
521500 /**
522501 * QP store stride
523− * Not to be accessed directly from outside libavutil
524502 */
525503 attribute_deprecated
526504 int qstride;
@@ -528,9 +506,6 @@ typedef struct AVFrame { · 1 unmodified line
528506 attribute_deprecated
529507 int qscale_type;
530508
531− /**
532− * Not to be accessed directly from outside libavutil
533− */
534509 AVBufferRef *qp_table_buf;
535510 #endif
536511 /**
@@ -552,9 +527,8 @@ typedef struct AVFrame { · 15 unmodified lines
552527 } AVFrame;
553528
554529 /**
555− * Accessors for some AVFrame fields.
556− * The position of these field in the structure is not part of the ABI,
557− * they should not be accessed directly outside libavutil.
530+ * Accessors for some AVFrame fields. These used to be provided for ABI
531+ * compatibility, and do not need to be used anymore.
558532 */
559533 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
560534 void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
libavutil/version.h+1−1
@@ -80,7 +80,7 @@ · 79 unmodified lines
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 55
8282 #define LIBAVUTIL_VERSION_MINOR 47
83−#define LIBAVUTIL_VERSION_MICRO 100
83+#define LIBAVUTIL_VERSION_MICRO 101
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
8686 LIBAVUTIL_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t